<template>
  <div class="container-whi-note">
    <el-dialog
      :title="dialogConfig.name"
      :visible.sync="dialogVisible"
      @close="dialogVisible = false"
      append-to-body
    >
      <!-- <el-form ref="formRef" :model="formData" :rules="rules">
        <el-form-item label="机器人uid" :label-width="'100px'" prop="name">
          <el-input v-model="formData.objectId" autocomplete="off"></el-input>
        </el-form-item>

        <el-form-item label="内容" :label-width="'100px'" prop="link">
          <el-input v-model="formData.content" autocomplete="off"></el-input>
        </el-form-item>
      </el-form> -->
      这是详情

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleConfirm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { deepClone } from '@/utils'
import { noteDetailApi } from '@api/whisper'
export default {
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    value: {
      type: Object
    },
    request: {
      type: Object
    },
    dialogConfig: {
      type: Object
    }
  },
  data() {
    return {
      posting: false,
      formData: this.setup(this.value),
      rules: {},
      detailData: {},
      replyList: []
    }
  },
  created() {},
  mounted() {},
  methods: {
    setup() {
      if (this.value) {
        console.log('this.value', this.value.id)
        this.handleDetail(this.value.id)
      }
    },
    handleDetail(id) {
      this.posting = true
      noteDetailApi(id)
        .then(res => {
          console.log('res----', res)
          if (res.data) {
            this.detailData = res.data
            this.replyList = res.data.replyPageInfo.list
          }
        })
        .catch(err => {
          this.$message('error')
        })
    },
    handleConfirm() {
      this.dialogVisible = false
    }
  },
  watch: {
    visible(val) {
      if (val) {
        this.formData = this.setup()
      }
    }
  },
  computed: {
    dialogVisible: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('update:visible')
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.container-whi-note {
}
</style>
